home *** CD-ROM | disk | FTP | other *** search
/ Aminet 34 / Aminet 34 (2000)(Schatztruhe)[!][Dec 1999].iso / Aminet / util / pack / xpk_Develop.lha / xpk_Develop / Include / Modula2 / XpkMasterD.def next >
Encoding:
Modula Definition  |  1998-11-09  |  14.1 KB  |  327 lines

  1. (*#-- BEGIN AutoRevision header, please do NOT edit!
  2. *
  3. * $VER: XpkMasterD.def 1.4 (28.10.1998)
  4. * Auth: T.B. <tonyiommi@geocities.com>
  5. *
  6. * Desc: XPKMaster Defs for xpk 4.25 (27.01.1998) by SDI
  7. * Reqs: AMIGA OS 2.0
  8. * Lang: MODULA-2
  9. * Comp: Cyclone © by M. Timmermans
  10. *-- END AutoRevision header --*)
  11.  
  12. DEFINITION MODULE XpkMasterD; (*$ Implementation- *)
  13.  
  14. FROM SYSTEM IMPORT ADDRESS,LONGSET;
  15. FROM UtilityD IMPORT tagUser;
  16.  
  17. TYPE  StrPtr = ADDRESS;
  18.  
  19. (* --- The packing/unpacking tags --- *)
  20. (* (TRUE) or (FALSE) mean the default value given by xpkmaster.library *)
  21.  
  22. CONST
  23.  tagBase=tagUser + ORD('X')*256 + ORD('P');
  24.  
  25. (* Caller must supply ONE of these to tell Xpk#?ack where to get data from *)
  26.  inName =tagBase+1; (* Process an entire named file *)
  27.  inFH   =tagBase+2; (* File handle - start from current position. If packing partial file, must also supply InLen *)
  28.  inBuf  =tagBase+3; (* Single unblocked memory buffer. Must also supply InLen *)
  29.  inHook =tagBase+4; (* Call custom Hook to read data. Must also supply InLen, when hook cannot do! (not for XPK unpacking) *)
  30.  
  31. (* Caller must supply ONE of these to tell Xpk#?ackFile where to send data to *)
  32.  outName    =tagBase+10H; (* Write (or overwrite) this data file *)
  33.  outFH      =tagBase+11H; (* File handle - write from current position on *)
  34.  outBuf     =tagBase+12H; (* Unblocked buffer - must also supply OutBufLen *)
  35.  getOutBuf  =tagBase+13H; (* Master allocates OutBuf - ti_Data points to buf ptr *)
  36.  outHook    =tagBase+14H; (* Callback Hook to get output buffers *)
  37.  
  38. (* --- Other tags for Pack/Unpack --- *)
  39.  inLen          =tagBase+20H; (* Length of data in input buffer *)
  40.  outBufLen      =tagBase+21H; (* Length of output buffer *)
  41.  getOutLen      =tagBase+22H; (* ti_Data points to long to receive OutLen *)
  42.  getOutBufLen   =tagBase+23H; (* ti_Data points to long to receive OutBufLen *)
  43.  password       =tagBase+24H; (* Password for de/encoding *)
  44.  getError       =tagBase+25H; (* ti_Data points to buffer for error message *)
  45.  outMemType     =tagBase+26H; (* Memory type for output buffer *)
  46.  passThru       =tagBase+27H; (* Bool: Pass through unrecognized formats on unpack *)
  47.  stepDown       =tagBase+28H; (* Bool: Step down pack method if necessary *)
  48.  chunkHook      =tagBase+29H; (* Call this Hook between chunks *)
  49.  packMethod     =tagBase+2AH; (* Do a FindMethod before packing *)
  50.  chunkSize      =tagBase+2BH; (* Chunk size to try to pack with *)
  51.  packMode       =tagBase+2CH; (* Packing mode for sublib to use *)
  52.  noClobber      =tagBase+2DH; (* Don't overwrite existing files *)
  53.  ignore         =tagBase+2EH; (* Skip this tag *)
  54.  taskPri        =tagBase+2FH; (* Change priority for (un)packing *)
  55.  fileName       =tagBase+30H; (* File name for progress report *)
  56.  shortError     =tagBase+31H; (* !!! obsolete !!! *)
  57.  packersQuery   =tagBase+32H; (* Query available packers *)
  58.  packerQuery    =tagBase+33H; (* Query properties of a packer *)
  59.  modeQuery      =tagBase+34H; (* Query properties of packmode *)
  60.  lossyOK        =tagBase+35H; (* Lossy packing permitted? (FALSE) *)
  61.  noCRC          =tagBase+36H; (* Ignore checksum *)
  62.  
  63. (* tags added for xfdmaster support (version 4 revision 25) *)
  64.  key16        =tagBase+37H; (* 16 bit key (unpack only) *)
  65.  key32        =tagBase+38H; (* 32 bit key (unpack only) *)
  66.  
  67. (* tag added to support seek (version 5) *)
  68.  needSeek    =tagBase+39H; (* turn on Seek function usage *)
  69.  
  70. (* preference depending tags added for version 4 - their default value may depend on preferences, see xpk/xpkprefs.h for more info *)
  71.  useXfdMaster  =tagBase+40H; (* Use xfdmaster.library (FALSE) *)
  72.  useExternals  =tagBase+41H; (* Use packers in extern dir (TRUE) *)
  73.  passRequest   =tagBase+42H; (* automatic password req.? (FALSE) *)
  74.  preferences   =tagBase+43H; (* use prefs semaphore ? (TRUE) *)
  75.  chunkReport   =tagBase+44H; (* automatic chunk report ? (FALSE) *)
  76.  
  77. (* tags tagBase+0x50) to tagBase+0x69) are for XpkPassRequest -- see below *)
  78.  
  79.  margin =256;   (* Safety margin for output buffer  *)
  80.  
  81. (* --- The hook function interface --- *)
  82. (* Message passed to InHook and OutHook as the ParamPacket *)
  83. TYPE
  84.  IOMsgPtr=POINTER TO IOMsg;
  85.  IOMsg=RECORD
  86.   type      :LONGINT;   (* Read/Write/Alloc/Free/Abort*)
  87.   ptr       :ADDRESS;   (* The mem area to read from/write to *)
  88.   size      :LONGINT;   (* The size of the read/write *)
  89.   ioError,  (* The IoErr() that occurred *)
  90.   reserved, (* Reserved for future use *)
  91.   private1, (* Hook specific, will be set to 0 by *)
  92.   private2, (* master library before first use *)
  93.   private3,
  94.   private4  :LONGINT;
  95.  END;
  96.  
  97. (* The values for XpkIoMsg->Type *)
  98. CONST
  99.  ioRead   =1;
  100.  ioWrite  =2;
  101.  ioFree   =3;
  102.  ioAbort  =4;
  103.  ioGetbuf =5;
  104.  ioSeek   =6;
  105.  ioTotSize=7;
  106.  
  107. (* --- The progress report interface --- *)
  108.  
  109. (* Passed to ChunkHook as the ParamPacket *)
  110. TYPE
  111.  ProgressPtr=POINTER TO Progress;
  112.  Progress=RECORD
  113.   type          :LONGINT;   (* Type of report: start/cont/end/abort *)
  114.   packerName,               (* Brief name of packer being used *)
  115.   packerLongName,           (* Descriptive name of packer being used *)
  116.   activity,                 (* Packing/unpacking message *)
  117.   fileName      :StrPtr;    (* Name of file being processed, if available *)
  118.   cCur,                     (* Amount of packed data already processed *)
  119.   uCur,                     (* Amount of unpacked data already processed *)
  120.   uLen,                     (* Amount of unpacked data in file *)
  121.   cf,                       (* Compression factor so far *)
  122.   done,                     (* Percentage done already *)
  123.   speed         :LONGINT;   (* Bytes per second, from beginning of stream *)
  124.   reserved      :ARRAY[1..8] OF LONGINT;    (* For future use *)
  125.  END;
  126.  
  127. CONST
  128.   progStart =1;
  129.   progMID   =2;
  130.   progEnd   =3;
  131.  
  132. (* --- The file info block --- *)
  133. TYPE
  134.  FibPtr = POINTER TO Fib;
  135.  Fib=RECORD
  136.   type,         (* Unpacked, packed, archive? *)
  137.   uLen,         (* Uncompressed length *)
  138.   cLen,         (* Compressed length *)
  139.   nLen,         (* Next chunk len *)
  140.   uCur,         (* Uncompressed bytes so far *)
  141.   cCur,         (* Compressed bytes so far *)
  142.   id            :LONGINT;                   (* 4 letter ID of packer *)
  143.   packer        :ARRAY[0..4] OF CHAR;       (* 4 letter name of packer *)
  144.   subVersion,                               (* Required sublib version *)
  145.   masVersion    :INTEGER;                   (* Required masterlib version *)
  146.   flags         :LONGSET;                   (* Password *)
  147.   head          :ARRAY[0..15] OF SHORTCARD; (* First 16 bytes of orig. file *)
  148.   ratio         :LONGINT;                   (* Compression ratio *)
  149.   reserved      :ARRAY[0..7] OF LONGINT;    (* For future use *)
  150.  END;
  151.  
  152. CONST
  153.  typeUnpacked =0; (* Not packed *)
  154.  typePacked   =1; (* Packed file *)
  155.  typeArchive  =2; (* Archive *)
  156.  
  157.  flagsPassword  = 1; (* Password needed *)
  158.  flagsNoSeek    = 2; (* Chunks are dependent *)
  159.  flagsNonSTD    = 4; (* Nonstandard file format *)
  160.  
  161.  (* defines added for xfdmaster support (version 4 revision 25) *)
  162.  flagsKey16    = 8; (* 16 bit key - for decrunching *)
  163.  flagsKey32    =16; (* 32 bit key - for decrunching *)
  164.  
  165. (* --- The error messages --- *)
  166.   errOK         =0;
  167.   errNoFunc     =-1;    (* This function not implemented *)
  168.   errNoFiles    =-2;    (* No files allowed for this function *)
  169.   errIoErrIn    =-3;    (* Input error happened *)
  170.   errIoErrOut   =-4;    (* Output error happened *)
  171.   errChecksum   =-5;    (* Check sum test failed *)
  172.   errVersion    =-6;    (* Packed file's version newer than lib *)
  173.   errNoMem      =-7;    (* Out of memory *)
  174.   errLibInUse   =-8;    (* For not-reentrant libraries *)
  175.   errWrongForm  =-9;    (* Was not packed with this library *)
  176.   errSmallBuf   =-10;   (* Output buffer too small *)
  177.   errLargeBuf   =-11;   (* Input buffer too large *)
  178.   errWrongMode  =-12;   (* This packing mode not supported *)
  179.   errNeedPassWD =-13;   (* Password needed for decoding *)
  180.   errCorruptPKD =-14;   (* Packed file is corrupt *)
  181.   errMissingLib =-15;   (* Required library is missing *)
  182.   errBadParams  =-16;   (* Caller's TagList was screwed up *)
  183.   errExpansion  =-17;   (* Would have caused data expansion *)
  184.   errNoMethod   =-18;   (* Cannot find requested method *)
  185.   errAborted    =-19;   (* Operation aborted by user *)
  186.   errTruncated  =-20;   (* Input file is truncated *)
  187.   errWrongCPU   =-21;   (* Better CPU required for this library *)
  188.   errPacked     =-22;   (* Data are already XPacked *)
  189.   errNotPacked  =-23;   (* Data not packed *)
  190.   errFileExists =-24;   (* File already exists *)
  191.   errOldMastlib =-25;   (* Master library too old *)
  192.   errOldSUBLIB  =-26;   (* Sub library too old *)
  193.   errNoCrypt    =-27;   (* Cannot encrypt *)
  194.   errNoInfo     =-28;   (* Can't get info on that packer *)
  195.   errLossy      =-29;   (* This compression method is lossy *)
  196.   errNoHardware =-30;   (* Compression hardware required *)
  197.   errBadHardware=-31;   (* Compression hardware failed *)
  198.   errWrongPW    =-32;   (* Password was wrong *)
  199.   errUnknown    =-33;   (* unknown error cause *)
  200.   errReqTimeOut =-34;        (* password request reached time out *)
  201.  
  202.   errMsgSize    =80;    (* Maximum size of an error message *)
  203.  
  204. (* --- The XpkQuery() call --- *)
  205. TYPE
  206.  PackerInfoPtr=POINTER TO PackerInfo;
  207.  PackerInfo=RECORD
  208.   name          :ARRAY[0..23] OF CHAR;  (* Brief name of the packer *)
  209.   longName      :ARRAY[0..31] OF CHAR;  (* Full name of the packer *)
  210.   description   :ARRAY[0..79] OF CHAR;  (* One line description of packer *)
  211.   flags         :LONGSET;               (* Defined below *)
  212.   maxChunk      :LONGINT;               (* Max input chunk size for packing *)
  213.   defChunk      :LONGINT;               (* Default packing chunk size *)
  214.   defMode       :INTEGER;               (* Default mode on 0..100 scale *)
  215.  END;
  216.  
  217. (* --- Defines for Flags --- *)
  218. CONST
  219.   pkChunk   =00001H; (* Library supplies chunk packing *)
  220.   pkStream  =00002H; (* Library supplies stream packing *)
  221.   pkArchive =00004H; (* Library supplies archive packing *)
  222.   upChunk   =00008H; (* Library supplies chunk unpacking *)
  223.   upStream  =00010H; (* Library supplies stream unpacking *)
  224.   upArchive =00020H; (* Library supplies archive unpacking *)
  225.   hookio    =00080H; (* Uses full Hook I/O *)
  226.   checking  =00400H; (* Does its own data checking *)
  227.   prereadhdr=00800H; (* Unpacker pre-reads the next chunkhdr *)
  228.   encryption=02000H; (* Sub library supports encryption *)
  229.   needpasswd=04000H; (* Sub library requires encryption *)
  230.   modes     =08000H; (* Sub library has different modes *)
  231.   lossy     =10000H; (* Sub library does lossy compression *)
  232.   noSeek    =20000H; (* unpacker does not support seeking *)
  233.  
  234. TYPE
  235.  ModePtr=POINTER TO Mode;
  236.  Mode=RECORD
  237.   next          :ModePtr;   (* Chain to next descriptor for ModeDesc list *)
  238.   upto,                     (* Maximum efficiency handled by this mode *)
  239.   flags         :LONGSET;   (* Defined below *)
  240.   packMemory,               (* Extra memory required during packing *)
  241.   unpackMemory,             (* Extra memory during unpacking *)
  242.   packSpeed,                (* Approx packing speed in K per second *)
  243.   unpackSpeed   :LONGINT;   (* Approx unpacking speed in K per second *)
  244.   ratio,                    (* CF in 0.1% *)
  245.   chunkSize     :INTEGER;   (* Desired chunk size in K (!!) for this mode *)
  246.   description   :ARRAY[0..9] OF CHAR;   (* 7 character mode description *)
  247.  END;
  248.  
  249. (* --- Defines for XpkMode.Flags --- *)
  250. CONST
  251.  a3000Speed =1; (* Timings on old environment, obsolete *)
  252.  noCPU      =2; (* Packing not heavily CPU dependent *)
  253.  upNoCPU    =4; (* Unpacking... (i.e. hardware modes) *)
  254.  
  255.  MaxPackers =100;
  256.  
  257. TYPE
  258.  PackerListPtr=POINTER TO PackerList;
  259.  PackerList=RECORD
  260.   numPackers:LONGINT;
  261.   packer    :ARRAY[0..MaxPackers-1],[0..5] OF CHAR;
  262.  END;
  263.  
  264. (* --- The XpkSeek() call (library version 5) --- *)
  265. CONST
  266.  seekBeginning    = -1;
  267.  seekCurrent    = 0;
  268.  seekEnd    = 1;
  269.  
  270. CONST
  271. (* --- The XpkPassRequest() call (library version 4) --- *)
  272.    passChars    =tagBase+50H; (* which chars should be used *)
  273.    passwordBuf  =tagBase+51H; (* buffer to write password to *)
  274.    passBufSize  =tagBase+52H; (* size of password buffer *)
  275.    key16BitPtr  =tagBase+53H; (* pointer to UWORD var for key data *)
  276.    key32BitPtr  =tagBase+54H; (* pointer to ULONG var for key data *)
  277.    pubScreen    =tagBase+55H; (* pointer to struct Screen *)
  278.    passTitle    =tagBase+56H; (* Text shown in Screen title *)
  279.    timeOut      =tagBase+57H; (* Timeout time of requester in seconds *)
  280.  
  281.    (* request position and verify tags (version 4 revision 25) *)
  282.    passWinLeft    =tagBase+58H; (* distance from left screen border *)
  283.    passWinTop    =tagBase+59H; (* distance form top screen border *)
  284.    passWinWidth =tagBase+5AH; (* width of requester window *)
  285.    passWinHeight=tagBase+5BH; (* height of requester window *)
  286.    passCenter   =tagBase+5CH; (* Left and Top are used as center coords *)
  287.    passVerify    =tagBase+5DH; (* force user to verify password *)
  288.  
  289. (* XPKPASSFF defines for  PassChars. Do not use. Use XPKPASSFLG defines *)
  290.   passFF30x39       =0;   (* all numbers      *)
  291.   passFF41x46       =1;   (* chars 'A' to 'F' *)
  292.   passFF61x66       =2;   (* chars 'a' to 'f' *)
  293.   passFF47x5A       =4;   (* chars 'G' to 'Z' *)
  294.   passFF67x7A       =8;   (* chars 'g' to 'z' *)
  295.   passFF20          =16;  (* space character  *)
  296.   passFFSpecial7Bit =32;  (* all chars 0x20 to 0x7E without above defined *)
  297.   passFFC0xDE       =64;  (* upper special chars  *)
  298.   passFFDFxFF       =128; (* lower special chars  *)
  299.   passFFSpecial8Bit =256; (* special 8Bit chars   *) (* all chars 0xA0 to 0xBF *)
  300.  
  301. (* flags for  PassChars, XPKPASSFLG_PRINTABLE is default *)
  302. (*
  303. NUMERIC     :numbers
  304. HEXADECIMAL :hex numbers
  305. ALPHANUMERIC:numbers and letters
  306. INTALPHANUM :numbers and international letters
  307. ASCII7      :7 Bit ASCII
  308. PRINTABLE   :all characters
  309. *)
  310.   passFlgNumeric        =passFF30x39;
  311.   passFlgHexadecimal    =passFF30x39+passFF41x46+passFF61x66;
  312.   passFlgAlphanumeric   =passFlgHexadecimal+passFF47x5A+passFF67x7A;
  313.   passFlgIntAlphanum    =passFlgAlphanumeric+passFFC0xDE+passFFDFxFF;
  314.   passFlgASCII7         =passFlgAlphanumeric+passFFSpecial7Bit;
  315.   passsFLGPrintable     =passFlgIntAlphanum+passFFSpecial7Bit+passFFSpecial8Bit+passFF20;
  316.  
  317. (* The XpkAllocObject() call (library version 4) *)
  318.  
  319. (* use this always with library version >= 4, do NO longer allocate the structures yourself *)
  320.   objFIB        =0; (* XpkFib structure *)
  321.   objPackerinfo =1; (* XpkPackerInfo structure *)
  322.   objMode       =2; (* XpkMode structure *)
  323.   objPackerlist =3; (* XpkPackerList structure *)
  324.  
  325. END XpkMasterD.
  326.